<Project DefaultTargets="Build">
  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

  <PropertyGroup>
    <PackageDescription>Provides the MonoAOTCompiler task</PackageDescription>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="$(RepoTasksDir)AotCompilerTask\MonoAOTCompiler.csproj" />

    <PackageFile Include="build\$(MSBuildProjectName).props" TargetPath="build" />
  </ItemGroup>

  <Target Name="_PrepareForPack" BeforeTargets="GetPackageFiles">
    <PropertyGroup>
      <SdkPropsPath>$(IntermediateOutputPath)Sdk.props</SdkPropsPath>
    </PropertyGroup>

    <ItemGroup>
      <_ReplacementValue Include="NetCoreAppToolCurrent" Value="$(NetCoreAppToolCurrent)" />
      <_ReplacementValue Include="NetFrameworkToolCurrent" Value="$(NetFrameworkToolCurrent)" />
    </ItemGroup>

    <GenerateFileFromTemplate
      TemplateFile="Sdk/Sdk.props.in"
      Properties="@(_ReplacementValue->'%(Identity)=%(Value)')"
      OutputPath="$(SdkPropsPath)" />

    <ItemGroup>
      <PackageFile Include="$(SdkPropsPath)" TargetPath="Sdk" />
    </ItemGroup>
  </Target>

  <Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
</Project>
